﻿<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" xmlns:Tutorial="clr-namespace:Tutorial"
    x:Class="Tutorial.Window1"
    Title="Window1" xmlns:WpfHero="clr-namespace:WpfHero;assembly=WHEngine" Width="500" Height="350">
	<Window.Resources>
		<Tutorial:BooleanToBoldConverter x:Key="BooleanToBoldConverter"/>
		<SolidColorBrush x:Key="ListBorder" Color="#828790"/>
		<Style x:Key="SongBrowserStyle" TargetType="{x:Type ListBox}">
			<Style.Resources>
				<Storyboard x:Key="Storyboard1">
					<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="{x:Null}" Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)">
						<SplineColorKeyFrame KeyTime="00:00:01" Value="#FFFFA700"/>
					</ColorAnimationUsingKeyFrames>
				</Storyboard>
				<Storyboard x:Key="Storyboard_Copy1">
					<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="{x:Null}" Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)">
						<SplineColorKeyFrame KeyTime="00:00:01" Value="#FFFFFFFF"/>
					</ColorAnimationUsingKeyFrames>
				</Storyboard>
			</Style.Resources>
			<Setter Property="Background" Value="#FFFFFFFF"/>
			<Setter Property="BorderBrush" Value="{StaticResource ListBorder}"/>
			<Setter Property="BorderThickness" Value="1"/>
			<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
			<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
			<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
			<Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
			<Setter Property="VerticalContentAlignment" Value="Center"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type ListBox}">
						<Border SnapsToDevicePixels="true" x:Name="Bd" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="1">
							<ScrollViewer Focusable="false" Padding="{TemplateBinding Padding}">
								<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
							</ScrollViewer>
						</Border>
						<ControlTemplate.Triggers>
							<Trigger Property="IsEnabled" Value="false">
								<Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
							</Trigger>
							<Trigger Property="IsGrouping" Value="true">
								<Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
							</Trigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
			<Style.Triggers>
				<Trigger Property="IsMouseOver" Value="True">
					<Trigger.ExitActions>
						<BeginStoryboard Storyboard="{StaticResource Storyboard_Copy1}" x:Name="Storyboard_Copy1_BeginStoryboard"/>
					</Trigger.ExitActions>
					<Trigger.EnterActions>
						<BeginStoryboard Storyboard="{StaticResource Storyboard1}"/>
					</Trigger.EnterActions>
				</Trigger>
			</Style.Triggers>
		</Style>
		<ObjectDataProvider x:Key="SongBrowserDS" d:IsDataSource="True" ObjectType="{x:Type Tutorial:SongBrowser}"/>
		<DataTemplate x:Key="SubDirectoriesTemplate">
			<StackPanel>
				<TextBlock Text="{Binding Path=Name, Mode=OneWay}" FontWeight="{Binding Path=HasSong, Converter={StaticResource BooleanToBoldConverter}, Mode=Default}"/>
			</StackPanel>
		</DataTemplate>
		<ObjectDataProvider x:Key="WHEngineDS" d:IsDataSource="True" ObjectType="{x:Type WpfHero:WHEngine}"/>
	</Window.Resources>
    <Grid>
        <ListBox HorizontalAlignment="Left" x:Name="songBrowser" Width="150" Style="{DynamicResource SongBrowserStyle}" ItemsSource="{Binding Path=SubDirectories, Mode=Default, Source={StaticResource SongBrowserDS}}" ItemTemplate="{DynamicResource SubDirectoriesTemplate}" KeyUp="songBrowser_KeyUp" MouseDoubleClick="songBrowser_MouseDoubleClick" d:LayoutOverrides="HorizontalAlignment" Margin="5,30,0,5" />
        <StackPanel HorizontalAlignment="Stretch" VerticalAlignment="Top" Height="20" Orientation="Horizontal" Margin="5,5,5,0">
        	<TextBox Text="Score" TextWrapping="Wrap" Margin="0,0,8,0"/>
        	<TextBox Text="{Binding Path=Score, Mode=Default, Source={StaticResource WHEngineDS}}" TextWrapping="Wrap" Margin="0,0,8,0"/>
        	<TextBox Text="Missed" TextWrapping="Wrap" Margin="0,0,8,0"/>
        	<TextBox Text="{Binding Path=MissedGemCount, Mode=Default, Source={StaticResource WHEngineDS}}" TextWrapping="Wrap" Margin="0,0,8,0"/>
        	<TextBox Text="Unnecessary" TextWrapping="Wrap" Margin="0,0,8,0"/>
        	<TextBox Text="{Binding Path=UnneccessaryStrums, Mode=Default, Source={StaticResource WHEngineDS}}" TextWrapping="Wrap" Margin="0,0,8,0"/>
        	<TextBox Text="Multiplier" TextWrapping="Wrap" Margin="0,0,8,0"/>
        	<TextBox Text="{Binding Path=Multiplier, Mode=Default, Source={StaticResource WHEngineDS}}" TextWrapping="Wrap" Margin="0,0,8,0"/>
        </StackPanel>
        <Tutorial:SongScroller HorizontalAlignment="Stretch" VerticalAlignment="Top" BorderThickness="0,0,0,0" Margin="200,30,5,0" Height="257" x:Name="scroller" DataContext="{Binding Mode=OneWay, Source={StaticResource WHEngineDS}}"/>
    </Grid>
</Window>
